package com.org.khtn.gui;

import java.awt.Component;

import javax.swing.JComboBox;
import javax.swing.JTable;
import javax.swing.table.TableCellRenderer;

public class DataTypeRenderer extends JComboBox implements TableCellRenderer {

	public DataTypeRenderer() {
		super();
		addItem("int");
		addItem("string");
		setOpaque(true);
	}

	public Component getTableCellRendererComponent(JTable table, Object value,
			boolean isSelected, boolean hasFocus, int row, int column) {
		String str = (String) value;
		if (str.compareToIgnoreCase("int") == 0) {
			setSelectedIndex(0);
		} else if (str.compareToIgnoreCase("string") == 0) {
			setSelectedIndex(1);
		}
		return this;
	}
}
